﻿using System;
using System.Diagnostics;
using Gean.Wrapper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pansoft.HIME.Base.Entities;
using Pansoft.HIME.Base.ViewModels;

namespace Pansoft.HIME.UnitTest.Base
{
    [TestClass]
    public class StaffViewModelTest
    {
        [TestMethod]
        public void TestTranslate()
        {
            var staff = new Staff()
                            {
                                Id = "a",
                                CreatedTime = new DateTime(2000, 1, 1, 1, 1, 1),
                                CreaterId = "b",
                                IsDeleted = false,
                                IsLogin = false,
                                LoginCounterId = 1,
                                MenderId = "c",
                                ModifiedTime = new DateTime(2001, 1, 1, 1, 1, 1),
                                Name = "abc",
                                OrganizationId = "oid",
                                Sex = PersonSex.Female,
                                Password = "pwd"
                            };
            var staffvm = new StaffViewModel();
            staffvm.Translate(staff);
            Assert.AreEqual(staff.Id, staffvm.Id);
            Assert.AreEqual(staff.CreatedTime, staffvm.CreatedTime);
            Assert.AreEqual(staff.CreaterId, staffvm.CreaterId);
            Assert.AreEqual(staff.IsDeleted, staffvm.IsDeleted);
            Assert.AreEqual(staff.IsLogin, staffvm.IsLogin);
            Assert.AreEqual(staff.LoginCounterId, staffvm.LoginCounterId);
            Assert.AreEqual(staff.MenderId, staffvm.MenderId);
            Assert.AreEqual(staff.ModifiedTime, staffvm.ModifiedTime);
            Assert.AreEqual(staff.Name, staffvm.Name);
            Assert.AreEqual(staff.OrganizationId, staffvm.OrganizationId);
            Assert.AreEqual(staff.Sex, staffvm.Sex);
            Assert.AreEqual(staff.Password, staffvm.Password);
        }
    }
}